﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"> 
	<title>出入境信息管理系统</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">  
	<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<style>
		html,body{
			width: 100%;
			height: 100%;
			font-size:85%;
		}
		.container{
			width: 98%;
		}
		.remove{
			color: red;
		}
		.edit{
			color: dodgerblue;
		}
		.search{
			color:yellowgreen;
			
		}
		td{
			width:auto;
		}
		select{
			width:100%;
		}
		
	</style>
</head>
<body>
	
	<nav class="navbar navbar-inverse" role="navigation" style="background-color: #333333;">
		<div class="container-fluid">
	    <div class="navbar-header">
	        <a class="navbar-brand" href="#" style="color: white;">办公自动化系统</a>
	    </div>
	    <div>
	        <ul class="nav navbar-nav">
	            <li><a href="#">出入境管理</a></li>
	            <li><a href="#">申请表管理</a></li>
	            <li><a href="#">共享打印机</a></li>
	            <li><a href="#"><span class="glyphicon glyphicon-plus-sign">添加管理项目</span></a></li>
	        </ul>
	        <ul class="nav navbar-nav navbar-right">
		      <li><a href="#"><span class="glyphicon glyphicon-user"></span> 注册</a></li>
		      <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> 登录</a></li>
		    </ul>
	    </div>
		</div>
	</nav>

	<h2>检索区：</h2> 
	<table class="table table-striped table-bordered table-hover table-condensed">
		<thead>
			<tr>
				<th>姓名</th>
				<th>身份证号</th>
				<th>性别</th>
				<th>民族</th>
				<th>政治面貌</th>
				<th>职称</th>
				<th>行政级别</th>
				<th>职务</th>
				<th>学院/部门</th>
				<th>最后学历</th>
								
				<th>证件号</th>
				<th>证件类型</th>
				
				<th>目的国家</th>
				<th>目的学校</th>
				<th>出访类型</th>
				<th>公派/自费</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<tr style="background-color:#FFFFCC;">
				<th id="name" contentEditable="true"></th>
				<th id="personid" contentEditable="true"></th>
				<th>
				<select id="sex">
				<option selected="selected">请选择</option>
									  <option value ="volvo">男</option>
									  <option value ="saab">女</option>
									</select>
				</th>
				<th>
				<select id="nation">
				<option selected="selected">请选择</option>
									  <option value ="volvo">汉族</option>
									  <option value ="saab">维吾尔族</option>
									  <option value="opel">回族</option>
									  <option value="audi">蒙古族</option>
									  <option value ="volvo">哈萨克族</option>
									  <option value ="saab">满族</option>
									  <option value="opel">锡伯族</option>
									  <option value="audi">塔吉克族</option>
									  <option value ="volvo">柯尔克孜族</option>
									  <option value ="saab">乌孜别克族</option>
									  <option value="opel">塔塔尔族</option>
									  <option value="audi">俄罗斯族</option>	  
									  <option value ="volvo">壮族</option>
									  <option value ="saab">彝族</option>
									  <option value="opel">达斡尔族</option>
									  <option value="audi">东乡族</option>
									  <option value ="volvo">藏族</option>
									  <option value ="saab">鄂伦春族 </option>			  
									  <option value="opel">羌族</option>
									  <option value="audi">朝鲜族</option>
									  <option value ="volvo">土家族</option>
									  <option value ="saab">哈尼族</option>
									  <option value="opel">傣族</option>
									  <option value="audi">布朗族 </option>
									   <option value="opel">其他</option>
									</select>
				</th>
				<th>
				<select id="face">
				<option selected="selected">请选择</option>
									   <option value ="volvo">中共党员</option>
									  <option value ="saab">共青团员</option>
									  <option value="opel">群众</option>
									  <option value="audi">九三学社</option>
									   <option value="opel">民盟</option>
									  <option value="audi">民建</option>
									   <option value="opel">农工党</option>
									  <option value="audi">致公党</option>
									   <option value="opel">民革</option>
									  <option value="audi">台湾民盟</option>
									  <option value="audi">其他</option>
									</select>
				</th>
				<th>
					<select id="job">
					<option selected="selected">请选择</option>
					  <option value ="volvo">正高级</option>
						 <option value ="saab">副高级</option>
						  <option value="opel">中级</option>
							  <option value="audi">初级</option>
					</select>
				</th>
				<th>
				<select id="adl">
				<option selected="selected">请选择</option>
											   <option value ="volvo">厅级</option>
											  <option value ="saab">副厅级</option>
											  <option value="opel">处级</option>
											  <option value="audi">副处级</option>
											   <option value="opel">科级</option>
											  <option value="audi">副科级</option>
											   <option value="opel">科员</option>
											  <option value="audi">办事员</option>
											  <option value="audi">其他</option>
											</select>
				</th>
				<th>
				<select id="post">
				<option selected="selected">请选择</option>
											   <option value ="volvo">院长</option>
											  <option value ="saab">副院长</option>
											  <option value="opel">院长助理</option>
											  <option value="audi">处长</option>
											   <option value="opel">副处长</option>
											  <option value="audi">学院书记</option>
											   <option value="opel">学院副书记</option>
											  <option value="audi">主任</option>
											  <option value="audi">副主任</option>
											   <option value ="volvo">部长</option>
											  <option value ="saab">副部长</option>
											  <option value="opel">馆长</option>
											  <option value="audi">副馆长</option>
											   <option value="opel">校长</option>
											  <option value="audi">副校长</option>
											   <option value="opel">校党委书记</option>
											  <option value="audi">校党委副书记</option>
											  <option value="audi">校长助理</option>
											   <option value="audi">科长</option>
											    <option value="audi">副科长</option>
											     <option value="audi">其他</option>
											</select>
				</th>
				<th>
				<select  id="department">
				<option selected="selected">请选择</option>
									<option value ="volvo">请选择</option>
									  <option value="audi">马克思主义学院</option>
									   <option value="opel">商学院</option>
									  <option value="audi">法学院</option>
									   <option value="opel">政治与公共管理学院</option>
									  <option value="audi">民族学与社会学学院</option>
									  <option value ="volvo">教育科学学院</option>
									  <option value ="saab">文学院</option>
									  <option value="opel">历史学院</option>
									  <option value="audi">语言学院</option>
									   <option value="opel">外国语学院</option>
									  <option value="audi">国际文化交流学院</option>
									   <option value="opel">数学科学学院</option>
									  <option value="audi">物理电子工程学院</option>
									   <option value="opel">计算机科学技术学院</option>
									  <option value="audi">地理科学与旅游学院</option>
									  <option value="audi">化学化工学院</option>
									  <option value ="volvo">生命科学学院</option>
									  <option value ="saab">体育学院</option>
									  <option value="opel">音乐学院</option>
									  <option value="audi">美术学院</option>
									   <option value="opel">初等教育学院</option>
									  <option value="audi">继续教育学院</option>
									   <option value="opel">网络教育学院</option>
									  <option value="audi">教师培训学院</option>
									   <option value="opel">青年政治学院</option>
									  <option value="audi">预科学院</option>
									  <option value="opel">新疆旅游培训学院</option>
									  <option value="audi">人事处</option>
									  <option value ="volvo">科研处</option>
									  <option value ="saab">研究生处</option>
									  <option value="opel">审计处</option>
									  <option value="audi">发展规划处</option>
									   <option value="opel">教务处</option>
									   <option value="opel">计划财务处</option>
									  <option value="audi">资产管理处</option>
									  <option value="audi">综合办公室</option>
									  <option value ="volvo">信息管理中心</option>
									  <option value ="saab">后勤管理处</option>
									  <option value="opel">国际合作交流处</option>
									  <option value="audi">图书馆</option>
									   <option value="opel">校长办公室</option>
									   <option value="audi">学生处</option>
									   <option value="audi">大学生就业指导中心</option>
									   <option value="audi">保卫处</option>
									   <option value="audi">国际化领导小组办公室</option>
									   <option value="audi">汉语国际教育办公室</option>
									   <option value="audi">校办产业管理办公室</option>
									   <option value="audi">实验室与设备管理处</option>
									   <option value="audi">温泉校区建设指挥部</option>
									   <option value="audi">文光校区综合管理办公室</option>
									   <option value="audi">温泉校区综合办公室</option>
									   <option value="audi">走出去工作领导小组办公室</option>
									  <option value ="volvo">党委办公室</option>
									  <option value ="saab">组织部</option>
									  <option value="opel">宣传部</option>
									  <option value="audi">纪检委办公室</option>
									   <option value="opel">团委</option>
									  <option value="audi">武装部</option>
									   <option value="opel">学生工作部</option>	 
									   <option value="opel">统战部</option>
									   <option value="opel">工会</option>
									   <option value="opel">监察室</option>
									  <option value ="volvo">图书馆</option>
									  <option value ="saab">学报编辑部</option>
									  <option value="opel">双语教育研究编辑部</option>
									  <option value="audi">附属中学</option>
									   <option value="opel">校医院</option>
									  <option value="audi">师资培训中心</option>
									   <option value="opel">学术交流中心</option>
									  <option value="audi">双语师资培训中心</option>
									   <option value="opel">高等学校师资培训中心</option>
									  <option value="audi">离退休职工管理服务中心</option>
									  <option value ="volvo">后勤服务中心</option>
									  <option value ="saab">国家大学生文化素质教育基地</option>
									  <option value="opel">大学生心理健康教育咨询与研究中心</option>
									  <option value="audi">中亚研究院</option>
									   <option value="opel">黄文弼中心</option>
									  <option value="audi">玛纳斯研究中心</option>
									   <option value="opel">沙漠藻研究中心</option>
									  <option value="audi">自治区教师资格认定中心</option>
									   <option value="opel">新疆大学生思想政治教育中心</option>
										<option>校领导</option>
										<option>其他</option>
									</select>
				</th>
				<th>
				<select id="education">
				<option selected="selected">请选择</option>
									  <option value ="volvo">专科</option>
									  <option value ="saab">本科</option>
									  <option value="opel">硕士</option>
									  <option value="audi">博士</option>
									</select>
				</th>
				
				<th id="pid" contentEditable="true"></th>
				<th>
				<select  id="kind">
				<option selected="selected">请选择</option>
									  <option value ="volvo">身份证</option>
									  <option value ="saab">公务护照</option>
									  <option value ="saab">因私护照</option>
									  <option value="opel">因公港澳通行证</option>
									  <option value="audi">因私台湾通行证</option>
									  <option value="opel">因私港澳通行证</option>
									  <option value="audi">因公台湾通行证</option>
									</select>
				</th>
				
				<th id="country" contentEditable="true"></th>
				<th id="college" contentEditable="true"></th>
				<th>
					<select id="outtype">
							<option selected="selected">请选择</option>
										  <option value ="volvo">学术交流</option>
										  <option value ="saab">项目合作</option>
										  <option value="opel">研修</option>
										  <option value="audi">访学</option>
										  <option value ="volvo">留学</option>
										  <option value ="saab">其他</option>
										</select>
				</th>
				<th id="coatby" contentEditable="true"></th>
				<th> <span class="glyphicon glyphicon-search search" onclick="search()" 
					data-toggle="tooltip" data-placement="top" title="直接在对应列输入搜索条件进行搜索">搜索</span></th>
			</tr>
		</tbody>
	</table>
	<h2>数据区：</h2>     
	<table class="table table-striped table-bordered table-hover table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>年度</th>
				<th>姓名</th>
				<th>身份证号</th>
				<th>性别</th>
				<th>民族</th>
				<th>政治面貌</th>
				<th>职称</th>
				<th>行政级别</th>
				<th>职务</th>
				<th>学院/部门</th>
				<th>最后学历</th>
				<th>联系方式</th>
				
				<th>证件号</th>
				<th>证件类型</th>
				<th>发证日期</th>
				<th>有效期</th>
				<th>证件归还时间</th>
				
				<th>目的国家</th>
				<th>目的学校</th>
				<th>出访类型</th>
				<th>交流主题</th>
				<th>出国时间</th>
				<th>回国时间</th>
				<th>公派/自费</th>
				<th>备注</th>
				<th>操作</th>
			</tr>
		</thead>
		
		<tbody id="tabledata">
		
			<tr style="display:none">
				<td id="moban"> <span class="glyphicon glyphicon-remove remove" onclick="remove(this)"
						 data-toggle="tooltip" data-placement="top" title="删除这一行？点击即可删除">删除</span></td>
			</tr>
			
		</tbody>
	</table>
	<center>
		<a href="#" onclick="exportData()"><button type="button" class="btn btn-info">导出报表</button></a>
		<a href="add.html"><button type="button" class="btn btn-info">新增记录</button></a>
		<button type="button" class="btn btn-info " onclick="searchOutDate()">查看证件到期者</button>
		<a href="#"><button type="button" class="btn btn-info" onclick="getweidaoqi()">查看证件未到期者</button></a>
		
		<a href="#"><button type="button" class="btn btn-info" onclick="getweiguihuan()">证件未归还者</button></a>
		<a href="#"><button type="button" class="btn btn-info" onclick="getyiguihuan()">证件已归还者</button></a>
		
		<a href="#"><button type="button" class="btn btn-info" onclick="getweihuiguo()">查看未回国者</button></a>
		<a href="staffmanager.html"><button type="button" class="btn btn-info">人员管理</button></a>
		<a href="passportmanager.html"><button type="button" class="btn btn-info">证照管理</button></a>
		
	</center>
	
</div>

</body>
	<script>
	
		var flag = "all";
	
		$(function () { 
			$(function () { $("[data-toggle='tooltip']").tooltip(); });
		});
		
		function getMsg(){
			$.post("getAllMsg.do", "",function(data){
				anData(data);
			});
		}
		
		function getweidaoqi(){
			flag = "weidaoqi";
			$.post("getweidaoqi.do","",function(data){
				removeRow();
				anData(data);
			});
		}
		function getweihuiguo(){
			flag = "weihuiguo";
			$.post("getweihuiguo.do","",function(data){
				removeRow();
				anData(data);
			});
		}
		
		function anData(data){
			var par = document.getElementById("tabledata");
			var res = data.split("\u0001");
			for(var i=0;i<res.length-1;i++){
				var caozuo = document.getElementById("moban").cloneNode(true);
				caozuo.setAttribute("id",i);
				var tr = document.createElement("tr");
				tr.setAttribute("class","myrow");
				var str = res[i].split("\u0005");
				
				var td = document.createElement("td");
				td.innerHTML = i+1;
				tr.appendChild(td);
				var td = document.createElement("td");
				td.innerHTML = str[20].split("-")[0];
				tr.appendChild(td);
				
				for(var j=0;j<str.length-1;j++){
					var td = document.createElement("td");
					td.innerHTML = str[j];
					tr.appendChild(td);
				}
				caozuo.setAttribute("pid",str[11]);
				caozuo.setAttribute("outdate",str[20]);
				tr.appendChild(caozuo);
				par.appendChild(tr);
			}
		}
		getMsg();
		
		function remove(node){
			if(flag!="all"){
				alert("基本人员护照信息不可删除！");
				return;
			}
			var msg = "您真的确定要删除吗？"; 
			if(confirm(msg)==false){
				return ;
			}
			var parent = node.parentNode;
			var pid = parent.getAttribute("pid");
			var outdate = parent.getAttribute("outdate");
			var parm = "pid="+pid+"&outdate="+outdate;
			$.post("delAction.do",parm,function(data){
				document.getElementById("tabledata").removeChild(parent.parentNode);
			});
		}
		
		function removeRow(){
			var p = document.getElementById("tabledata");
			var c = document.getElementsByClassName("myrow");
			for(var i=c.length-1;i>=0;i--) c[i].parentNode.removeChild(c[i]);
		}
		
		function getSelect(myselect){
			var index=myselect[0].selectedIndex;
			return myselect[0].options[index].text;
		}
		
		function clickSearchBtn(){
			var name = $("#name").text();
			var personid = $("#personid").text();
			var sex = getSelect($("#sex"));
			var nation = getSelect($("#nation"));
			var face = getSelect($("#face"));
			var job = getSelect($("#job"));
			var adl = getSelect($("#adl"));
			var post = getSelect($("#post"));
			var department = getSelect($("#department"));
			var education = getSelect($("#education"));
			
			var country = $("#country").text();
			var college = $("#college").text();
			var outtype = getSelect($("#outtype"));
			var costby = $("#costby").text();
			
			var pid = $("#pid").text();
			var kind = getSelect($("#kind"));
			
			var parm = "country="+country+"&college="+college;
			parm+="&costby="+costby+"&pid="+pid;
			
			parm+="&name="+name+"&personid="+personid+"&sex="+sex+"&nation="+nation+"&face="+face;
			parm+="&job="+job+"&adl="+adl+"&department="+department+"&education="+education;
			parm+="&post="+post+"&outtype="+outtype;
			
			parm+="&kind="+kind;
			parm = parm.replace(/请选择/g,"");
			return parm;
			
		}
		
		function search(){
			flag = "search";
			var parm = clickSearchBtn();
			$.post("search.do",parm,function(data){
				removeRow();
				anData(data);
			});
		}
		
		function searchOutDate(){
			flag = "outdate";
			$.post("searchOutDate.do","flag=flag",function(data){
				removeRow();
				anData(data);
			});
		}
		
		function getweiguihuan(){
			flag = "no";
			$.post("isReturnPP.do","flag="+flag,function(data){
				removeRow();
				anData(data);
			});
		}
		
		function getyiguihuan(){
			flag = "yes";
			$.post("isReturnPP.do","flag="+flag,function(data){
				removeRow();
				anData(data);
			});
		}
		
		function exportData(){
			if(flag=="weidaoqi" || flag=="weihuiguo"){
				window.location.href = "export2.xls?flag="+flag;
				return;
			}
			var parm = clickSearchBtn();
			window.location.href = "export.xls?"+parm+"&flag="+flag;
		}

	</script>
	
</html>